package com.zhan.ielts.dao.impl;

import com.zhan.frame.core.dao.impl.BaseDaoImpl;
import com.zhan.frame.core.exception.DaoException;
import com.zhan.frame.core.utils.BeanUtils;
import com.zhan.ielts.dao.MessageDao;
import com.zhan.ielts.domain.Message;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Repository
public class MessageDaoImpl extends BaseDaoImpl<Message> implements MessageDao {

	@Override
	public Long selectLatestCount(Message query) {
		try {
			Map<String, Object> params = BeanUtils.toMap(query);
			return sqlSessionTemplate.selectOne(
					getSqlName("selectLatestCount"), params);
		} catch (Exception e) {
			throw new DaoException(String.format("查询对象总数出错！语句：%s",
					getSqlName("selectLatestCount")), e);
		}
	}

}
